package com.spic.business.getui.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Configuration
public class GetuiConfig {
    @Bean
    public ThreadPoolExecutor getThreadPoolExecutor()
    {
        return  new ThreadPoolExecutor(
                10,              //coreSize 核心线程数
                30,              //MaxSize 最大线程数
                60,             //60   存活时间
                TimeUnit.SECONDS,        //单位(秒)
                new LinkedBlockingQueue<Runnable>(20),        //对列数
                new ThreadPoolExecutor.CallerRunsPolicy()        //拒绝策略(直接由提交任务者执行这个任务)
        );
    }
}
